<template>
  <el-pagination
    @size-change="handleSizeChange"
    @current-change="handlePageChange"
    :current-page="queryObject.page"
    :page-sizes="[10,15,20]"
    :page-size="queryObject.size"
    layout="total, sizes, prev, pager, next, jumper"
    :total="total">
  </el-pagination>
</template>

<script>
  export default {
    name: 'Pagination',
    props: {
      queryObject: Object,
      loadPage: Function,
      total: Number,
    },
    methods: {
      handleSizeChange(size) {
        this.$emit('pageChange', { page: 1, size })
        this.loadPage()
      },
      handlePageChange(page) {
        this.$emit('pageChange', { page })
        this.loadPage()
      },
    }
  }
</script>
